import time

from httprunner import __version__
from faker import Faker
faker = Faker(locale='zh_CN')
name = faker.name()

def get_httprunner_version():
    return __version__


def sum_two(m, n):
    return m + n


def sleep(n_secs):
    time.sleep(n_secs)

def get_info():
    return name

# def get_id():
#     import requests
#     response =requests.post(url="http://121.196.225.233:8899/adminapi/login",
#                             json={"account":"admin","pwd":"123456","key":"686760e1c7416","captchaType":"blockPuzzle","captchaVerification":""})
#     token = response.json()['data']['token']
#
#     response = requests.get(url="http://121.196.225.233:8899/adminapi/user/user_group/list?page=1&limit=15",
#                             headers={"Authori-zation":"Bearer " + str(token) })
#
#     for i in response.json()['data']['list']:
#         if i['group_name'] == "小小小":
#              return i["id"]
#         elif i['group_name'] == "小小小111":
#             return  i["id"]

    # response = requests.get(url="http://121.196.225.233:8899/adminapi/app/wechat/speechcraft",headers={"Authori-zation":"Bearer " + str(token)'})
    #
    # for i in response.json()["data"]["list"]:
    #     if i["label_name"] == "喜洋洋":
    #         return i["id"]
    #     elif i["label_name"] == "喜洋洋111":
    #         return i["id"]
    # response = requests.get(url="http://121.196.225.233:8899/adminapi/user/user_label",headers={"Authori-zation":"Bearer " + str(token)'})
    # for i in response.json()["data"]["list"]:
    #     if i["name"] == "喜洋洋":
    #         return i["id"]
    #     elif i["name"] == "喜洋洋111":
    #         return i["id"]

def get_groupbyid_sql():
    import pymysql
    db = pymysql.connect(host="121.196.225.233",user="root",password="w84947398540",database="crmeb")
    cursor = db.cursor()

    if cursor.execute("select * from eb_user_group where group_name='小小小' "):
        data = cursor.fetchone()
        return data[0]
    elif cursor.execute("select * from eb_user_group where group_name='小小小111' "):
        data = cursor.fetchone()
        return data[0]
    db.close()
def get_tagid_sql():
    import pymysql
    db = pymysql.connect(host="121.196.225.233", user="root", password="w84947398540", database="crmeb")
    cursor = db.cursor()
    if cursor.execute("select * from eb_user_label where label_name='喜洋洋' "):
        data = cursor.fetchone()
        return data[0]
    elif cursor.execute("select * from eb_user_label where label_name='喜洋洋111' "):
        data = cursor.fetchone()
        return data[0]


def get_Speechid_sql():
    import pymysql
    db = pymysql.connect(host="121.196.225.233", user="root", password="w84947398540", database="crmeb")
    cursor = db.cursor()
    if cursor.execute("select * from eb_store_service_speechcraft where message='喜洋洋' "):
        data = cursor.fetchone()
        return data[0]
    elif cursor.execute("select * from eb_store_service_speechcraft where message='喜洋洋111' "):
        data = cursor.fetchone()
        return data[0]







